define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme', 'template'], function ($, undefined, Backend, Datatable, Table, Echarts, undefined, Template) {

    var Controller = {
			index: function () {
				
					// 基于准备好的dom，初始化echarts实例
				var myChart = Echarts.init(document.getElementById('echart'), 'walden');

				// 指定图表的配置项和数据
				var option = {
					title: {
						text: '',
						subtext: ''
					},
					tooltip: {
						trigger: 'axis'
					},
					legend: {
						data: [__('Sales'), __('Orders')]
					},
					toolbox: {
						show: false,
						feature: {
							magicType: {show: true, type: ['stack', 'tiled']},
							saveAsImage: {show: true}
						}
					},
					xAxis: {
						type: 'category',
						boundaryGap: false,
						data: Orderdata.column
					},
					yAxis: {

					},
					grid: [{
							left: 'left',
							top: 'top',
							right: '10',
							bottom: 30
						}],
					series: [{
							name: __('Sales'),
							type: 'line',
							smooth: true,
							areaStyle: {
								normal: {
								}
							},
							lineStyle: {
								normal: {
									width: 1.5
								}
							},
							data: Orderdata.paydata
						},
						{
							name: __('Orders'),
							type: 'line',
							smooth: true,
							areaStyle: {
								normal: {
								}
							},
							lineStyle: {
								normal: {
									width: 1.5
								}
							},
							data: Orderdata.createdata
						}]
				};

				//使用刚指定的配置项和数据显示图表。
				myChart.setOption(option);
				var sevendau=0;  //在线人数
				var roomCount = 0; //当开房数
				setInterval(function () {
					 $.ajax({
						url: Config.GameDB.api_url + 'onlineUsers',
						type: 'GET',
						dataType: 'json',
						success: function (ret) {
								//debugger;
							sevendau=ret;
						}
					}); 
					//获取开房数量
					  $.ajax({
						url: Config.GameDB.api_url + 'gamingUser',
						type: 'GET',
						dataType: 'json',
						success: function (ret) {
								//debugger;
							for (x in ret)
							{
								roomCount = roomCount+ret[x].roomCount;
							}
						}
					}); 
					
					Orderdata.column.push((new Date()).toLocaleTimeString().replace(/^\D*/, '')); //时间

					Orderdata.paydata.push(sevendau); //在线人数
					Orderdata.createdata.push(roomCount);//开房数
					sevendau =0 ; //情况当前在线人数.
					roomCount = 0; //当开房数清空
					
					//按自己需求可以取消这个限制
					if (Orderdata.column.length >= 20) {
						//移除最开始的一条数据
						Orderdata.column.shift();
						Orderdata.paydata.shift();
						Orderdata.createdata.shift();
					}
					myChart.setOption({
						xAxis: {
							data: Orderdata.column
						},
						
						series: [{
								name: __('Sales'),
								data: Orderdata.paydata
							},
							{
								name: __('Orders'),
								data: Orderdata.createdata
							}]
					});
				}, 2000);
				$(window).resize(function () {
					myChart.resize();
				});
				
				//读取FastAdmin的更新信息
				$.ajax({
					url: Config.fastadmin.api_url + '/news/index',
					type: 'post',
					dataType: 'jsonp',
					success: function (ret) {
						$("#news-list").html(Template("newstpl", {news: ret.newslist}));
					}
				});
				$.ajax({
					url: Config.fastadmin.api_url + '/forum/discussion',
					type: 'post',
					dataType: 'jsonp',
					success: function (ret) {
						$("#discussion-list").html(Template("discussiontpl", {news: ret.discussionlist.slice(0,6)}));
					}
				});
				

				
				
				//登录注册数据统计
				var myChart3 = Echarts.init(document.getElementById('data3'));
				
				var uploadedDataURL3 = "/admin/recharge/Api/Getloggingdata";
				
					$.getJSON(uploadedDataURL3, function(TmpData) {
					//提取时间数据
					var xData = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['hours']);
						}
						return data;
					}();

					//提取client数据
					var clientData = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['amount']);
						}
						return data;
					}();


					
					
					var option3 = {
						 //backgroundColor: "#344b58",
						"title": {
							"text": "注册数据统计",
							x: "10%",
							top:'10%',

							textStyle: {
								color: '#446699',
								fontSize: '14'
							}
						},
						"tooltip": {
							"trigger": "axis",
							"axisPointer": {
								"type": "shadow",
								textStyle: {
									color: "#fff"
								}

							},
						},
						toolbox: {
							feature: {
								mark : {show: true},  
								dataView : {show: false, readOnly: false},  
								magicType : {show: true, type: ['line', 'bar']},  
								restore : {show: true},  
								saveAsImage: {show: true}
								}
						},
						"grid": {
							"borderWidth": 0,
							"top": '25%',
							"bottom": '15%',
							textStyle: {
								color: "#fff"
							}
						},
						"legend": {
							x: '30%',
							top: '90%',
							textStyle: {
								color: '#90979c',
							},
							"data": ['每日注册数','总数']
						},
						 

						"calculable": true,
						"xAxis": [{
							"type": "category",
							"axisLine": {
								lineStyle: {
									color: '#90979c'
								}
							},
							"splitLine": {
								"show": false
							},
							"axisTick": {
								"show": false
							},
							"splitArea": {
								"show": false
							},
							"axisLabel": {
								"interval": 0,
							},
							"data": xData,
						}],
						"yAxis": [{
							"type": "value",
							"splitLine": {
								"show": false
							},
							"axisLine": {
								lineStyle: {
									color: '#90979c'
								}
							},
							"axisTick": {
								"show": false
							},
							"axisLabel": {
								"interval": 0,

							},
							"splitArea": {
								"show": false
							},

						}],
						
						"series": [{
								"name": "每日注册数",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#45CBDC",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": clientData
							},{
								"name": "总数",
								"type": "line",
								"stack": "总数",
								symbolSize:8,
								symbol:'circle',
								"itemStyle": {
									"normal": {
										"color": "#6ca7e2",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": clientData
							},
						]
					}
					// 使用刚指定的配置项和数据显示图表。
						myChart3.setOption(option3,true);
				});
				
				
				//开房数据统计
				// 基于准备好的dom，初始化echarts实例	
				var myChart4 = Echarts.init(document.getElementById('data4'));
				
				var uploadedDataURL4 = "/admin/recharge/Api/GetOpenroomdata";
				
				$.getJSON(uploadedDataURL4, function(TmpData) {
					//提取时间数据
				
					var xData = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['time']);
						}
						return data;
					}();

					//提取client数据
					var clientData = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['client']);
						}
						return data;
					}();

					//提取血战麻将数据
					var game100 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game100']);
						}
						return data;
					}();
					
					//提取万州麻将数据
					var game120 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game120']);
						}
						return data;
					}();
					
				   //提取幺鸡代数据
					var game121 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game121']);
						}
						return data;
					}();
					
					//提取幺鸡落地数据
					var game122 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game122']);
						}
						return data;
					}();
					
					//提取广安麻将数据
					var game140 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game140']);
						}
						return data;
					}();
					
					//提取扣点点数据
					var game160 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game160']);
						}
						return data;
					}();
					
					//提取推倒胡数据
					var game170 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game170']);
						}
						return data;
					}();
					
					//提取呼伦贝尔数据
					var game190 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game190']);
						}
						return data;
					}();
					
					//提取斗地主数据
					var game300 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game300']);
						}
						return data;
					}();
					
					//提取拼三张数据
					var game320 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game320']);
						}
						return data;
					}();
					
					//提取牛牛数据
					var game340 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game340']);
						}
						return data;
					}();
					
					//提取三公数据
					var game360 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game360']);
						}
						return data;
					}();
					
					//提取掷骰子数据
					var game380 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game380']);
						}
						return data;
					}();
					
					var option4 = {
						 //backgroundColor: "#344b58",
						"title": {
							"text": "开房数据统计",
							x: "10%",
							top:'10%',

							textStyle: {
								color: '#446699',
								fontSize: '14'
							}
						},
						"tooltip": {
							"trigger": "axis",
							"axisPointer": {
								"type": "shadow",
								textStyle: {
									color: "#fff"
								}

							},
						},
						toolbox: {
							feature: {
								mark : {show: true},  
								dataView : {show: false, readOnly: false},  
								magicType : {show: true, type: ['line', 'bar']},  
								restore : {show: true},  
								saveAsImage: {show: true}
								}
						},
						"grid": {
							"borderWidth": 0,
							"top": '25%',
							"bottom": '15%',
							textStyle: {
								color: "#fff"
							}
						},
						"legend": {
							x: '15%',
							top: '90%',
							textStyle: {
								color: '#90979c',
							},
							"data": ['成都血战','万州麻将', '幺鸡代','幺鸡落地','广安麻将','扣点点','推倒胡','呼伦贝尔','斗地主','拼三张', '牛牛','三公','掷骰子', '总数']
						},
						 

						"calculable": true,
						"xAxis": [{
							"type": "category",
							"axisLine": {
								lineStyle: {
									color: '#90979c'
								}
							},
							"splitLine": {
								"show": false
							},
							"axisTick": {
								"show": false
							},
							"splitArea": {
								"show": false
							},
							"axisLabel": {
								"interval": 0,
							},
							"data": xData,
						}],
						"yAxis": [{
							"type": "value",
							"splitLine": {
								"show": false
							},
							"axisLine": {
								lineStyle: {
									color: '#90979c'
								}
							},
							"axisTick": {
								"show": false
							},
							"axisLabel": {
								"interval": 0,

							},
							"splitArea": {
								"show": false
							},

						}],
						
						"series": [{
								"name": "成都血战",
								"type": "bar",
								"stack": "总数",
								"barMaxWidth": 25,
								"barGap": "20%",
								"itemStyle": {
									"normal": {
										"color": "#44ACE0",
										"label": {
											"show": true,
											"textStyle": {
												"color": "#fff"
											},
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game100,
							},{
								"name": "万州麻将",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#5BCEA2",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game120
							}, {
								"name": "幺鸡代",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#65CD7C",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game121
							},{
								"name": "幺鸡落地",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#8585DA",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game122
							},{
								"name": "广安麻将",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#F1DB5F",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game140
							},{
								"name": "扣点点",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#E2A252",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game160
							},{
								"name": "推倒胡",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#EA8880",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game170
							},{
								"name": "呼伦贝尔",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#5283D3",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game190
							},{
								"name": "斗地主",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#24B589",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game300
							},{
								"name": "拼三张",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#90979c",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game320
							},{
								"name": "牛牛",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#6C890B",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game340
							},{
								"name": "三公",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#DFB5B7",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game360
							},{
								"name": "掷骰子",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#7F1874",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game380
							},{
								"name": "总数",
								"type": "line",
								"stack": "总数",
								symbolSize:8,
								symbol:'circle',
								"itemStyle": {
									"normal": {
										"color": "#6ca7e2",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": clientData
							},
						]
					}
					// 使用刚指定的配置项和数据显示图表。
						myChart4.setOption(option4,true);
				});
				
				
				//房卡消耗数据统计
				// 基于准备好的dom，初始化echarts实例	
				var myChart5 = Echarts.init(document.getElementById('data5'));
				
				var uploadedDataURL5 = "/admin/recharge/Api/Getroomdeplete";
				
				$.getJSON(uploadedDataURL5, function(TmpData) {
					//提取时间数据
					//debugger;
					var xData = function() {
						var data = [];
						for (var i = 1; i < TmpData.length; i++) {
							data.push(TmpData[i]['time']);
						}
						return data;
					}();

					//提取client数据
					var clientData = function() {
						var data = [];
						for (var i = 1; i < TmpData.length; i++) {
							data.push(TmpData[i]['client']);
						}
						return data;
					}();

					//提取血战麻将数据
					var game100 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game100']);
						}
						return data;
					}();
					
					//提取万州麻将数据
					var game120 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game120']);
						}
						return data;
					}();
					
				   //提取幺鸡代数据
					var game121 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game121']);
						}
						return data;
					}();
					
					//提取幺鸡落地数据
					var game122 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game122']);
						}
						return data;
					}();
					
					//提取广安麻将数据
					var game140 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game140']);
						}
						return data;
					}();
					
					//提取扣点点数据
					var game160 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game160']);
						}
						return data;
					}();
					
					//提取推倒胡数据
					var game170 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game170']);
						}
						return data;
					}();
					
					//提取呼伦贝尔数据
					var game190 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game190']);
						}
						return data;
					}();
					
					//提取斗地主数据
					var game300 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game300']);
						}
						return data;
					}();
					
					//提取拼三张数据
					var game320 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game320']);
						}
						return data;
					}();
					
					//提取牛牛数据
					var game340 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game340']);
						}
						return data;
					}();
					
					//提取三公数据
					var game360 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game360']);
						}
						return data;
					}();
					
					//提取掷骰子数据
					var game380 = function() {
						var data = [];
						for (var i = 0; i < TmpData.length; i++) {
							data.push(TmpData[i]['game380']);
						}
						return data;
					}();
					
					var option5 = {
						 //backgroundColor: "#344b58",
						"title": {
							"text": "房卡消耗数据统计",
							x: "10%",
							top:'10%',

							textStyle: {
								color: '#446699',
								fontSize: '14'
							}
						},
						"tooltip": {
							"trigger": "axis",
							"axisPointer": {
								"type": "shadow",
								textStyle: {
									color: "#fff"
								}

							},
						},
						 toolbox: {
					feature: {
						mark : {show: true},  
						dataView : {show: false, readOnly: false},  
						magicType : {show: true, type: ['line', 'bar']},  
						restore : {show: true},  
						saveAsImage: {show: true}
						}
					},
						"grid": {
							"borderWidth": 0,
							"top": '25%',
							"bottom": '15%',
							textStyle: {
								color: "#fff"
							}
						},
						"legend": {
							x: '15%',
							top: '90%',
							textStyle: {
								color: '#90979c',
							},
							"data": ['成都血战','万州麻将', '幺鸡代','幺鸡落地','广安麻将','扣点点','推倒胡','呼伦贝尔','斗地主','拼三张', '牛牛','三公','掷骰子', '总数']
						},
						 

						"calculable": true,
						"xAxis": [{
							"type": "category",
							"axisLine": {
								lineStyle: {
									color: '#90979c'
								}
							},
							"splitLine": {
								"show": false
							},
							"axisTick": {
								"show": false
							},
							"splitArea": {
								"show": false
							},
							"axisLabel": {
								"interval": 0,
							},
							"data": xData,
						}],
						"yAxis": [{
							"type": "value",
							"splitLine": {
								"show": false
							},
							"axisLine": {
								lineStyle: {
									color: '#90979c'
								}
							},
							"axisTick": {
								"show": false
							},
							"axisLabel": {
								"interval": 0,

							},
							"splitArea": {
								"show": false
							},

						}],
						
						"series": [{
								"name": "成都血战",
								"type": "bar",
								"stack": "总数",
								"barMaxWidth": 25,
								"barGap": "20%",
								"itemStyle": {
									"normal": {
										"color": "#44ACE0",
										"label": {
											"show": true,
											"textStyle": {
												"color": "#fff"
											},
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game100,
							},{
								"name": "万州麻将",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#5BCEA2",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game120
							}, {
								"name": "幺鸡代",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#65CD7C",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game121
							},{
								"name": "幺鸡落地",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#8585DA",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game122
							},{
								"name": "广安麻将",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#F1DB5F",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game140
							},{
								"name": "扣点点",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#E2A252",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game160
							},{
								"name": "推倒胡",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#EA8880",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game170
							},{
								"name": "呼伦贝尔",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#5283D3",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game190
							},{
								"name": "斗地主",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#24B589",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game300
							},{
								"name": "拼三张",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#90979c",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game320
							},{
								"name": "牛牛",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#6C890B",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game340
							},{
								"name": "三公",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#DFB5B7",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game360
							},{
								"name": "掷骰子",
								"type": "bar",
								"stack": "总数",
								"itemStyle": {
									"normal": {
										"color": "#7F1874",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": game380
							},{
								"name": "总数",
								"type": "line",
								"stack": "总数",
								symbolSize:8,
								symbol:'circle',
								"itemStyle": {
									"normal": {
										"color": "#6ca7e2",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": clientData
							},
						]
					}
					// 使用刚指定的配置项和数据显示图表。
						myChart5.setOption(option5,true);
				});
				
				
				//在线数据统计
				// 基于准备好的dom，初始化echarts实例	
				var myChart6 = Echarts.init(document.getElementById('data6'));
				
				var uploadedDataURL6 = "/admin/recharge/Api/GetOnlinedata";
				
				$.getJSON(uploadedDataURL6, function(JSONTmpData) {
					//提取时间数据
					//debugger;
					var tmpdata = JSON.parse(JSONTmpData);
					var xData = function() {
						var data = [];
						for (var i = 0; i < tmpdata.length; i++) {
							data.push(tmpdata[i]['time']);
						}
						return data;
					}();

					//提取client数据
					var clientData = function() {
						var data = [];
						for (var i = 0; i < tmpdata.length; i++) {
							data.push(tmpdata[i]['num']);
						}
						return data;
					}();
					
					var option6 = {
						 //backgroundColor: "#344b58",
						"title": {
							"text": "在线数据统计",
							x: "10%",
							top:'10%',

							textStyle: {
								color: '#446699',
								fontSize: '14'
							}
						},
						"tooltip": {
							"trigger": "axis",
							"axisPointer": {
								"type": "shadow",
								textStyle: {
									color: "#fff"
								}

							},
						},
						 toolbox: {
					feature: {
						mark : {show: true},  
						dataView : {show: false, readOnly: false},  
						magicType : {show: true, type: ['line', 'bar']},  
						restore : {show: true},  
						saveAsImage: {show: true}
						}
					},
						"grid": {
							"borderWidth": 0,
							"top": '25%',
							"bottom": '15%',
							textStyle: {
								color: "#fff"
							}
						},
						"legend": {
							x: '30%',
							top: '90%',
							textStyle: {
								color: '#90979c',
							},
							"data": ['在线人数', '总数']
						},
						 
						"calculable": true,
						"xAxis": [{
							"type": "category",
							"axisLine": {
								lineStyle: {
									color: '#90979c'
								}
							},
							"splitLine": {
								"show": false
							},
							"axisTick": {
								"show": false
							},
							"splitArea": {
								"show": false
							},
							"axisLabel": {
								"interval": 0,
							},
							"data": xData,
						}],
						"yAxis": [{
							"type": "value",
							"splitLine": {
								"show": false
							},
							"axisLine": {
								lineStyle: {
									color: '#90979c'
								}
							},
							"axisTick": {
								"show": false
							},
							"axisLabel": {
								"interval": 0,

							},
							"splitArea": {
								"show": false
							},

						}],
						
						"series": [{
								"name": "在线人数",
								"type": "bar",
								"stack": "总数",
								"barMaxWidth": 25,
								"barGap": "20%",
								"itemStyle": {
									"normal": {
										"color": "#44ACE0",
										"label": {
											"show": true,
											"textStyle": {
												"color": "#fff"
											},
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": clientData,
							},{
								"name": "总数",
								"type": "line",
								"stack": "总数",
								symbolSize:8,
								symbol:'circle',
								"itemStyle": {
									"normal": {
										"color": "#6ca7e2",
										"barBorderRadius": 0,
										"label": {
											"show": true,
											"position": "top",
											formatter: function(p) {
												return p.value > 0 ? (p.value) : '';
											}
										}
									}
								},
								"data": clientData
							},
						]
					}
					// 使用刚指定的配置项和数据显示图表。
						myChart6.setOption(option6,true);
				});
				
				
				//游戏占比数据统计
				//基于准备好的dom，初始化echarts实例	
				var myChart7 = Echarts.init(document.getElementById('data7'));
				var dataAll = [389, 259, 262, 324, 232, 176, 196, 214, 133, 370];
				var yAxisData = ['万州麻将','原因2','原因3','原因4','原因5','原因6','原因7','原因8','原因9','原因10'];
				var option7 = {
					backgroundColor: '#0f375f',
					title:[
						{text:"各游戏开房占比",x: '2%', y: '1%',textStyle:{color:"#fff",fontSize:"14"}},
						{text:"游戏房间排行TOP",x: '40%', y: '1%',textStyle:{color:"#fff",fontSize:"14"}},
						{text:"各游戏房卡消耗占比",x: '2%', y: '50%',textStyle:{color:"#fff",fontSize:"14"}},
					],
					grid: [
						{x: '50%', y: '7%', width: '45%', height: '90%'},
					],
					tooltip: {
						formatter: '{b} ({c})'
					},
					xAxis: [
						{gridIndex: 0, axisTick: {show:false},axisLabel: {show:false},splitLine: {show:false},axisLine: {show:false }},
					],
					yAxis: [
						 {  gridIndex: 0, interval:0,data:yAxisData.reverse(),
							axisTick: {show:false}, axisLabel: {show:true},splitLine: {show:false},
							axisLine: {show:true,lineStyle:{color:"#6173a3"}},
						}
					],
					series: [
						{
							name: '各游戏开房占比',
							type: 'pie',
							radius : '30%',
							center: ['22%', '25%'],
							color:['#86c9f4','#4da8ec','#3a91d2','#005fa6','#315f97'],
							data:[
								{value:335, name:'万州麻将'},
								{value:310, name:'幺鸡代'},
								{value:234, name:'幺鸡落地'},
								{value:135, name:'拼三张'},
								{value:105, name:'牛牛'},
							],
							labelLine:{normal:{show:false}},
							itemStyle: {normal: {label:{ show: true,  formatter: '{b} \n ({d}%)', textStyle:{color:'#B1B9D3'}} },},
						},
						{
							name: '各游戏房卡消耗占比',
							type: 'pie',
							radius : '30%',
							center: ['22%', '75%'],
							color:['#86c9f4','#4da8ec','#3a91d2','#005fa6','#315f97'],
							labelLine:{normal:{show:false}},
							data:[
								{value:335, name:'A级'},
								{value:310, name:'B级'},
								{value:234, name:'C级'},
								{value:135, name:'D级'},
							],
							itemStyle: {normal: {label:{ show: true,  formatter: '{b} \n ({d}%)', textStyle:{color:'#B1B9D3'}} },},
						},
						{
							name: '游戏排行TOP',
							type: 'bar',xAxisIndex: 0,yAxisIndex: 0,barWidth:'45%',
							itemStyle:{normal:{color:'#86c9f4'}},
							label:{normal:{show:true, position:"right",textStyle:{color:"#9EA7C4"}}},
							data: dataAll.sort(),
						},
						
					]
				};
				
				//使用刚指定的配置项和数据显示图表。
				myChart7.setOption(option7,true);
			},
			
			
    };

    return Controller;
});
